/**
 *****************************************************************************
 * @file    co_types.h
 *
 * @brief    -
 *
 * Copyright (C) RealMega 2019-2020
 *
 *****************************************************************************
*/

#ifndef __CO_TYPES_H__
#define __CO_TYPES_H__


#define PACKED      __attribute__((packed))


#ifndef BIT
#define BIT(x)            (1 << (x))

#define BIT0              (1ul << 0)
#define BIT1              (1ul << 1)
#define BIT2              (1ul << 2)
#define BIT3              (1ul << 3)
#define BIT4              (1ul << 4)
#define BIT5              (1ul << 5)
#define BIT6              (1ul << 6)
#define BIT7              (1ul << 7)
#define BIT8              (1ul << 8)
#define BIT9              (1ul << 9)
#define BIT10             (1ul << 10)
#define BIT11             (1ul << 11)
#define BIT12             (1ul << 12)
#define BIT13             (1ul << 13)
#define BIT14             (1ul << 14)
#define BIT15             (1ul << 15)
#define BIT16             (1ul << 16)
#define BIT17             (1ul << 17)
#define BIT18             (1ul << 18)
#define BIT19             (1ul << 19)
#define BIT20             (1ul << 20)
#define BIT21             (1ul << 21)
#define BIT22             (1ul << 22)
#define BIT23             (1ul << 23)
#define BIT24             (1ul << 24)
#define BIT25             (1ul << 25)
#define BIT26             (1ul << 26)
#define BIT27             (1ul << 27)
#define BIT28             (1ul << 28)
#define BIT29             (1ul << 29)
#define BIT30             (1ul << 30)
#define BIT31             (1ul << 31)
#endif

#ifndef NULL
#define NULL                0
#endif

#ifndef TRUE
#define TRUE                1
#endif

#ifndef FALSE
#define FALSE               0
#endif

#define FUNC_CALLER         __builtin_return_address(0)

enum COMMON_ERR_CODES
{
    CO_ERR_SUCCESS          = 0x00,
    CO_ERR_INVALID_PARAM    = 0x01,
    CO_ERR_INVALID_STATE    = 0x02,
    CO_ERR_OUT_OF_MEMORY    = 0x03,
    CO_ERR_NOT_FOUND        = 0x04,
    CO_ERR_WRITE_FLASH      = 0x05,
    CO_ERR_EXCEED_LIMITS    = 0x06,
    CO_ERR_NOT_ALIGNED      = 0x07,
};

#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <stdarg.h>

#endif

